<template>
  <div>
    <client-only>
      <vue-office-pdf
          :src="pdf"
          @rendered="renderedHandler"
          @error="errorHandler"
      />
    </client-only>
  </div>
</template>
<script setup>
const route = useRoute()
import VueOfficePdf from '@vue-office/pdf'
const pdf = ref("")
const handleLoadData = async (id)=>{
  const resp = await useLoadResumeTemplateFileDetail(id)
  pdf.value = resp.data
}

let handleChange = (e) => {
  let files = e.target.files[0];
  let reader = new FileReader();
  reader.readAsArrayBuffer(files);
  reader.onload = function () {
    pdf.value = reader.result;
  };
}

const renderedHandler = () =>{
  console.log("渲染完成")
}
const errorHandler= () =>{
  console.log("渲染失败")
}

definePageMeta({
  layout:"login"
})

onMounted(()=>{
  handleLoadData(route.query.id)
})
</script>

<style scoped>

</style>